package com.leetcode.week.week293;

import java.util.Arrays;

/**
 * @author angzhijin
 * @Description
 * @create 2022-05-15 10:45 上午
 */
public class Week2 {
    public static void main(String[] args) {

    }

    public static int maxConsecutive(int bottom, int top, int[] special) {
        Arrays.sort(special);
        int max =0;
        int length = special.length;
        for (int i = 0; i < length; i++) {
            if(i==0) {
                max = Math.max(max, special[i]-bottom);
            }else {
                max = Math.max(max, special[i]-special[i-1]-1);
            }
        }
        max = Math.max(max, top- special[length-1]);
        return max;
    }
}
